<?xml version="1.0" encoding="ISO-8859-1"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions"
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:a="http://www.andromda.org/cartridges/jsf"
      xmlns:tr="http://myfaces.apache.org/trinidad"
      xmlns:ajsfc="http://www.andromda.org/cartridges/jsf/facelets"
      >

<ui:composition template="/layout/layout.xhtml">
    <ui:param name="partialTriggers" value="#{fn:split(':manageRoleForm_search:newAction :manageRoleForm_search:searchResult:loadAction :manageRoleForm_edit:saveAction :manageRoleForm_edit:saveAndNewAction :manageRoleForm_edit:cancelAction',' ')}"/>
    <ui:param name="usesUpload" value="false"/>
    <ui:define name="title">
        <c:set var="title" value="#{messages['role.view.title']}#{messages['title.action.separator']}#{messages[manageRoleForm.editState ? (empty manageRoleForm.id ? 'title.action.new' : 'title.action.edit') : 'title.action.search']}" scope="request"/>
    </ui:define>
    <ui:define name="content">
        <tr:panelGroupLayout layout="vertical" inlineStyle="display:#{manageRoleForm.editState?'none':''}">
        <tr:subform id="manageRoleForm_search">
        <tr:panelFormLayout>
        <tr:inputText id="searchForm_roleCode" value="#{manageRoleForm.searchForm.roleCode}" label="#{messages['role.role.code']}:" required="false" readOnly="false">
        </tr:inputText>
        <tr:inputText id="searchForm_role" value="#{manageRoleForm.searchForm.role}" label="#{messages['role.role']}:" required="false" readOnly="false">
        </tr:inputText>
        <tr:inputText id="searchForm_roleDescription" value="#{manageRoleForm.searchForm.roleDescription}" label="#{messages['role.role.description']}:" required="false" readOnly="false">
        </tr:inputText>
        <tr:selectManyListbox id="searchForm_roleClearanceLevels" value="#{manageRoleForm.searchForm.roleClearanceLevels}" label="#{messages['role.role.clearance.levels']}:" required="false" readOnly="false" size="3">
            <c:if test="${!empty manageRoleForm.roleClearanceLevelsBackingList}">
                <c:forEach var="row" items="#{manageRoleForm.roleClearanceLevelsBackingList}">
                    <f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
                </c:forEach>
            </c:if>
        </tr:selectManyListbox>
        <tr:selectManyListbox id="searchForm_applications" value="#{manageRoleForm.searchForm.applications}" label="#{messages['role.applications']}:" required="false" readOnly="false" size="3">
            <c:if test="${!empty manageRoleForm.applicationsBackingList}">
                <c:forEach var="row" items="#{manageRoleForm.applicationsBackingList}">
                    <f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
                </c:forEach>
            </c:if>
        </tr:selectManyListbox>
        <tr:selectManyListbox id="searchForm_programs" value="#{manageRoleForm.searchForm.programs}" label="#{messages['role.programs']}:" required="false" readOnly="false" size="3">
            <c:if test="${!empty manageRoleForm.programsBackingList}">
                <c:forEach var="row" items="#{manageRoleForm.programsBackingList}">
                    <f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
                </c:forEach>
            </c:if>
        </tr:selectManyListbox>
        <tr:selectManyListbox id="searchForm_menus" value="#{manageRoleForm.searchForm.menus}" label="#{messages['role.menus']}:" required="false" readOnly="false" size="3">
            <c:if test="${!empty manageRoleForm.menusBackingList}">
                <c:forEach var="row" items="#{manageRoleForm.menusBackingList}">
                    <f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
                </c:forEach>
            </c:if>
        </tr:selectManyListbox>
        <f:facet name="footer">
            <tr:panelButtonBar>
                <tr:commandButton id="searchAction" text="#{messages['action.search']}" action="#{roleController.search}" accessKey="#{messages['action.search.access.key']}" partialSubmit="true"/>
                <tr:commandButton id="newAction" text="#{messages['action.new']}" action="#{roleController.startNew}" accessKey="#{messages['action.new.access.key']}" partialSubmit="true" immediate="true"/>
            </tr:panelButtonBar>
        </f:facet>
        </tr:panelFormLayout>
        <tr:spacer width="1" height="10"/>
        <tr:table id="searchResult" allDetailsEnabled="true" var="row" rowBandingInterval="1" value="#{manageRoleForm.manageableList}" rows="#{preferences.maxTableRows}" width="90%" inlineStyle="display:#{manageRoleForm.manageableList == null? 'none': ''}" partialTriggers="searchResult:deleteAction ::searchAction">
            <f:facet name="footer">
                <h:panelGroup>
                    <tr:outputText value="#{fn:length(manageRoleForm.manageableList)}">
                        <f:convertNumber groupingUsed="true"/>
                    </tr:outputText>
                    <tr:spacer width="10" height="1"/>
                    <tr:outputText value="#{messages['records.found']}"/>
                </h:panelGroup>
                <h:panelGroup style="width:100%;font-weight:normal">
                    <tr:outputText value="#{fn:length(manageRoleForm.manageableList)}" inlineStyle="display:#{empty manageRoleForm.manageableList?'none':''}">
                        <f:convertNumber groupingUsed="true"/>
                    </tr:outputText>
                    <tr:spacer width="10" height="1" inlineStyle="display:#{empty manageRoleForm.manageableList?'none':''}"/>
                    <tr:outputText value="#{messages['records.found']}" inlineStyle="display:#{empty manageRoleForm.manageableList?'none':''}"/>
                    <tr:outputText value="#{messages['empty.result.set']}" inlineStyle="display:#{empty manageRoleForm.manageableList?'':'none'}"/>
                </h:panelGroup>
            </f:facet>
            <tr:column width="46px">
                <f:facet name="header">
                    <h:panelGroup>
                        <tr:commandLink action="#{roleController.odsExport}" inlineStyle="display:#{empty manageRoleForm.manageableList?'none':''}">
                            <tr:image source="/images/spreadsheet.png" shortDesc="#{messages['export.spreadsheet']}" inlineStyle="border-style:none" />
                        </tr:commandLink>
                    </h:panelGroup>
                </f:facet>
                <h:panelGroup>
                    <tr:commandLink id="loadAction" actionListener="#{roleController.load}" partialSubmit="true" immediate="true">
                       <tr:image source="/images/tableLoad.gif" shortDesc="#{messages['action.load']}" inlineStyle="border-style:none" />
                       <f:param name="id" id="id" value="#{row.id}" />
                    </tr:commandLink>
                    <tr:spacer width="10" height="1"/>
                    <tr:commandLink id="deleteAction" actionListener="#{roleController.delete}" partialSubmit="true" immediate="true">
                        <tr:image source="/images/tableDelete.gif" shortDesc="#{messages['action.delete']}" inlineStyle="border-style:none" />
                        <f:param name="id" id="id" value="#{row.id}" />
                    </tr:commandLink>
                </h:panelGroup>
            </tr:column>
            <tr:column sortable="true" sortProperty="roleCode">
                <f:facet name="header">
                    <tr:outputText value="#{messages['role.role.code']}"/>
                </f:facet>
                <tr:outputText value="#{row.roleCode}">
                </tr:outputText>
            </tr:column>
            <tr:column sortable="true" sortProperty="role">
                <f:facet name="header">
                    <tr:outputText value="#{messages['role.role']}"/>
                </f:facet>
                <tr:outputText value="#{row.role}">
                </tr:outputText>
            </tr:column>
            <tr:column sortable="true" sortProperty="roleDescription">
                <f:facet name="header">
                    <tr:outputText value="#{messages['role.role.description']}"/>
                </f:facet>
                <tr:outputText value="#{row.roleDescription}">
                </tr:outputText>
            </tr:column>
        </tr:table>
        </tr:subform>
        </tr:panelGroupLayout>
        <tr:panelGroupLayout layout="vertical" inlineStyle="display:#{manageRoleForm.editState?'':'none'}">
        <tr:subform id="manageRoleForm_edit" >
            <tr:panelFormLayout>
        <tr:inputText id="roleCode" value="#{manageRoleForm.roleCode}" label="#{messages['role.role.code']}:" required="true" readOnly="false">
        </tr:inputText>
        <tr:inputText id="role" value="#{manageRoleForm.role}" label="#{messages['role.role']}:" required="true" readOnly="false">
        </tr:inputText>
        <tr:inputText id="roleDescription" value="#{manageRoleForm.roleDescription}" label="#{messages['role.role.description']}:" required="true" readOnly="false">
        </tr:inputText>
            <tr:inputHidden id="id" value="#{manageRoleForm.id}"/>
            <tr:selectManyListbox id="roleClearanceLevels" value="#{manageRoleForm.roleClearanceLevels}" label="#{messages['role.role.clearance.levels']}:" required="false" readOnly="false" size="3">
                   <c:if test="${!empty manageRoleForm.roleClearanceLevelsBackingList}">
                       <c:forEach var="row" items="#{manageRoleForm.roleClearanceLevelsBackingList}">
                           <f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
                       </c:forEach>
                   </c:if>
            </tr:selectManyListbox>
            <tr:selectManyListbox id="applications" value="#{manageRoleForm.applications}" label="#{messages['role.applications']}:" required="false" readOnly="false" size="3">
                   <c:if test="${!empty manageRoleForm.applicationsBackingList}">
                       <c:forEach var="row" items="#{manageRoleForm.applicationsBackingList}">
                           <f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
                       </c:forEach>
                   </c:if>
            </tr:selectManyListbox>
            <tr:selectManyListbox id="programs" value="#{manageRoleForm.programs}" label="#{messages['role.programs']}:" required="false" readOnly="false" size="3">
                   <c:if test="${!empty manageRoleForm.programsBackingList}">
                       <c:forEach var="row" items="#{manageRoleForm.programsBackingList}">
                           <f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
                       </c:forEach>
                   </c:if>
            </tr:selectManyListbox>
            <tr:selectManyListbox id="menus" value="#{manageRoleForm.menus}" label="#{messages['role.menus']}:" required="false" readOnly="false" size="3">
                   <c:if test="${!empty manageRoleForm.menusBackingList}">
                       <c:forEach var="row" items="#{manageRoleForm.menusBackingList}">
                           <f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
                       </c:forEach>
                   </c:if>
            </tr:selectManyListbox>

            <f:facet name="footer">
                   <tr:panelButtonBar>
                       <tr:commandButton id="saveAction" text="#{messages['action.save']}" action="#{roleController.save}" accessKey="#{messages['action.save.access.key']}" partialSubmit="false"/>
                       <tr:commandButton id="saveAndNewAction" text="#{messages['action.saveAndNew']}" action="#{roleController.saveAndNew}" accessKey="#{messages['action.saveAndNew.access.key']}" inlineStyle="display:#{(empty manageRoleForm.id)?'':'none'}" partialSubmit="false"/>
                       <tr:commandButton id="cancelAction" text="#{messages['action.cancel']}" action="#{roleController.cancel}" accessKey="#{messages['action.cancel.access.key']}" immediate="true" partialSubmit="true" />
                   </tr:panelButtonBar>
            </f:facet>
            </tr:panelFormLayout>
        </tr:subform>
        </tr:panelGroupLayout>
    </ui:define>
</ui:composition>

</html>
